<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>

<script type="text/javascript">
    
		$(function(){           
			$('*[title]').monnaTip();
		});
	</script>

<h3 id="oceny">Oceny dla klasy ${classItem.className} - ${subjectItem.subjectName}</h3>
<h6>Stan klasy: ${count}</h6>
<div style="font-style: italic;">Osoby niewidoczne na liście nie posiadają jeszcze żadnej oceny.</div>
<table class="content_table">
	<tr>
		<th>Imię i nazwisko</th>
		<th style="width: 50%">Oceny</th>
		<th>Średnia ocen</th>
	</tr>
	<c:forEach items="${userGrades}" var="grade">
	<tr>
		<td>${grade.key.firstName} ${grade.key.lastName}</td>
		<td style="font-weight: bolder">
			<c:forEach items="${grade.value}" var="gradeItem"> 
				<span title="${gradeItem.gradeDescription}">${gradeItem.gradeValue}</span>
				<a href="<c:url value="/teacher/deleteGrade" />?id=${gradeItem.gradeId}&class=${classItem.classId}&subject=${subjectItem.subjectId}" >
				x
				</a>
			</c:forEach>
		</td>
		<td>
		<fmt:formatNumber type="number" minFractionDigits="2" maxFractionDigits="2">${grade.key.average}</fmt:formatNumber>
		</td>
	</tr>
	</c:forEach>
</table>

<form:form commandName="newGrade">
<form:hidden path="subjects" />
<table>

	<tr>
	<td colspan="2">
	
	<div style="color: green">${dodano}</div>

	
	</td>
	</tr>
	<tr>
	<td colspan="2">
	
	<form:errors path="gradeValue" cssClass="error_box" />

	
	</td>
	</tr>
	<tr>
		<td><form:label path="gradeValue">Ocena:</form:label></td>
		<td><form:input path="gradeValue" size="1" /></td>
	</tr>
	<tr>
	<td colspan="2">
	
	<form:errors path="gradeDescription" cssClass="error_box" />

	
	</td>
	</tr>
	<tr>
		<td><form:label path="gradeValue">Opis oceny:</form:label></td>
		<td><form:textarea path="gradeDescription" size="1" /></td>
	</tr>
	<tr>
	<td colspan="2">
	
	<form:errors path="users" cssClass="error_box" />

	
	</td>
	</tr>
	<tr>
		<td><form:label path="users">Uczeń:</form:label></td>
		<td><form:select path="users" size="1">
			<form:option value="">Wybierz...</form:option>
			<form:options items="${studentsOptions}"/>
		</form:select></td>
	</tr>
</table>
	<input type="submit" value="Dodaj" />
</form:form>


